package com.tommy.ddp
{
	import com.tommy.ddp.box.DdpBox;
	import com.tommy.ddp.grid.DdpGrid;
	
	import org.taomee.ds.HashMap;

	public class GridDataManager
	{
		private static var gridHashMap:HashMap;
		private static var boxHashMap:HashMap;
		
		public function GridDataManager()
		{
		}
		setup();
		private static function setup():void
		{
			gridHashMap = new HashMap();
			boxHashMap = new HashMap();
		}
		
		public static function regGrid(xIndex:int,yIndex:int,grid:DdpGrid):void
		{
			gridHashMap.add(xIndex+"_"+yIndex,grid);
		}
		
		public static function getGrid(xIndex:int,yIndex:int):DdpGrid
		{
			return gridHashMap.getValue(xIndex+"_"+yIndex);
		}
		
		
		public static function regBox(xIndex:int,yIndex:int,box:DdpBox):void
		{
			boxHashMap.add(xIndex+"_"+yIndex,box);
		}
		
		public static function getBox(xIndex:int,yIndex:int):DdpBox
		{
			return boxHashMap.getValue(xIndex+"_"+yIndex);
		}
		
		/**
		 * BOX被消除以后从HASHMAP里移除
		 * @param box
		 * 
		 */		
		public static function removeBox(box:DdpBox):void
		{
			boxHashMap.remove(box.column+"_"+box.row);
		}
	}
}